<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	request.setCharacterEncoding("UTF-8");
	response.setContentType("text/html;charset=UTF-8");
%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
	String path = request.getContextPath();
%>
<html lang="zh-cn">
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title>登录</title>  
    <link rel="stylesheet" href="<%=path %>/admin/css/pintuer.css">
    <link rel="stylesheet" href="<%=path %>/admin/css/admin.css">
    <script type="text/javascript">
    var paths = '<%=path%>';
    var pics = '${plan.planPics}';
    var piclist  = pics.split(",");
    </script>
    <script src="<%=path %>/admin/js/jquery.js"></script>
    <script src="<%=path %>/admin/js/pintuer.js"></script>  
    <script src="<%=path %>/admin/js/pic2.js"></script>
    <script type="text/javascript" src="<%=path%>/admin/js/lrz.bundle.js" ></script>
    <script type="text/javascript" src="<%=path%>/admin/js/lrz.all.bundle.js" ></script>
	<script type="text/javascript" src="<%=path%>/admin/js/1.chunk.js" ></script>
	<script type="text/javascript" src="<%=path%>/admin/js/2.chunk.js" ></script>
		
</head>
<body>
	<div class="panel admin-panel">
  <div class="panel-head" id="add"><strong><span class="icon-pencil-square-o"></span>修改内容</strong></div>
  <div class="body-content">
    <form id="planForm" method="post" class="form-x" action="<%=path %>/planManage/update">  
      <div class="form-group">
        <div class="label">
          <label>案例名称：</label>
        </div>
        <div class="field">
          <input type="hidden" id="planId" name="planId" value="${plan.planId }" />
          <input type="text" class="input w50 clear" value="${plan.planName }" name="planName" id="planName" data-validate="required:请输入案例名称" />
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>案例描述：</label>
        </div>
        <div class="field">
          <textarea  class="input w50 clear" style="height:130px;overflow-y:scroll;"  name="planDescription" id="planDescription" data-validate="required:请输入案例描述" >${plan.planDescription }</textarea>
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>出品公司：</label>
        </div>
        <div class="field">
          <input type="text" class="input w50 clear" value="${plan.planCompnay }" name="planCompnay" id="planCompnay" data-validate="required:请输入出品公司" />
          <div class="tips"></div>
        </div>
      </div>   
      
      <if condition="$iscid eq 1">
         <div class="form-group">
       <!--    <div class="label">
            <label>标签：</label>
            <input name="planTag" id="planTag" type="hidden" value=""/>
          </div> -->
          <input name="planTag" id="planTag" type="hidden" value="${plan.planTag }"/>
          <div style="width:100%;float:left">
          <div class="label">
            <label>行业：</label>
          </div>
          <div class="field" style="width:80%">
          	 <div class="dx">
          	 	 <!-- <span>行业：</span> -->
          	 	 <ul>
          	 	 	<c:forEach items="${hangyeList }" var="list" varStatus="s">
              			<li><label ><input name="checkTag" class="plantags" type="checkbox" value="${list.dicCode }" /><span>${list.dicName }</span></label></li>
              		</c:forEach>
          	 	 </ul>
          	 </div>
          </div>
         </div>
         <div style="width:100%;float:left">
          <div class="label">
            <label>节日：</label>
          </div>
          <div class="field" style="width:80%">
          	 <div class="dx">
          	 	 <!-- <span>节日：</span> -->
          	 	 <ul>
          	 	 	<c:forEach items="${jieriList }" var="list" varStatus="s">
              			<li><label ><input name="checkTag" class="plantags" type="checkbox" value="${list.dicCode }" /><span>${list.dicName }</span></label></li>
              		</c:forEach>
          	 	 </ul>
          	 </div>
          	</div>
          	</div>
           <div style="width:100%;float:left">
          <div class="label">
            <label>功能：</label>
          </div>
          	<div class="field" style="width:80%">
          	 <div class="dx">
          	 	<!--  <span>功能：</span> -->
          	 	 <ul>
          	 	 	<c:forEach items="${gongnengList }" var="list" varStatus="s">
              			<li><label><input name="checkTag" class="plantags" type="checkbox" value="${list.dicCode }" /><span>${list.dicName }</span></label></li>
              		</c:forEach>
          	 	 </ul>
          	 </div>
          </div>
          </div>
         <div style="width:100%;float:left">
          <div class="label">
            <label>支持PC预览：</label>
          </div>
          	<div class="field" style="width:80%">
          	 <div class="dx">
          	 	<label><input type="radio" value="0" name="planSuitPhone" <c:if test="${plan.planSuitPhone == 0 }">checked="checked"</c:if> />是</label>
          	 	<label><input type="radio" value="1" name="planSuitPhone" <c:if test="${plan.planSuitPhone == 1 }">checked="checked"</c:if> />否</label>
          	 </div>
          </div>
          </div>
        </div>
               <div class="form-group">
	        <div class="label">
	          <label>上传封面：</label>
	          <input name="planCover" id="planCover" type="hidden" value="${plan.planCover }"/>
	          </div>
	          <div class="field" style="width:85%;">
	        	<div id="view" style="height:260px;width:356px;margin-top:10px;border-radius:3px;margin-bottom:40px;float:left;border:1px solid #ddd;">
	        </div>
	       <!--  <div class="" style="width:85%;">
	          <div class="picture" style="position: relative;">	
					<a href="#" class="a-upload" id="im10">
						<input id="file_upload10" type="file" name="img10" class="pics" /> 
						<div class="image_container" style="z-index:-1;">
							<img id="preview10" class="imgs">
						</div>       
					</a>							
				</div>
	        </div> -->
	      </div>
        <div class="form-group">
	        <div class="label">
	          <label>访问地址：</label>
	        </div>
	        <div class="field">
	          <input type="text" class="input w50 clear" value="${plan.planUrl }" name="planUrl" id="planUrl" data-validate="required:请输入访问地址" />
	          <div class="tips"></div>
	        </div>
	      </div>
        <div class="form-group">
					<div class="label">
	          <label>上传照片：</label>
	          <input name="planPics" id="planPics" type="hidden" value="${plan.planPics }"/>
	        </div class="all-pic">
					<div class="qu" style="width:85%;float: left;margin-right: 5%;">						
						<div class="picture" style="position: relative;">
							<a href="#" class="a-upload" id="im1" >
								<input id="file_upload1" type="file" name="img1" class="pics"/>
								<div class="image_container" style="z-index:-1;">
									<img id="preview1" class="imgs" src="" >
								</div>      
							</a>
						</div>	    
											

						<div class="picture" style="position: relative;">	
	
							<a href="#" class="a-upload" id="im2">
								<input id="file_upload2" type="file" name="img2" class="pics" /> 
								<div class="image_container" style="z-index:-1;">
									<img id="preview2" class="imgs">
								</div>       
							</a>							
						</div>
	
						<div class="picture" style="position: relative;">	
	
							<a href="#" class="a-upload" id="im3">
	
								<input id="file_upload3" type="file"  name="img3" class="pics" /> 
								<div class="image_container" style="z-index:-1;">
								    <img id="preview3" class="imgs">
								</div>
							</a>
						</div>
						<%-- <span class="btnss"><img src="<%=path%>/admin/images/jia.png" /></span> --%>
						<div class="picture" id="pic4" style="position: relative;">		
							<a href="#" class="a-upload" id="im4">
								<input id="file_upload4" type="file" name="img4" class="pics addpic" /> 
								<div class="image_container" style="z-index:-1;">
								    <img id="preview4" class="imgs">
								</div>      
							</a>
						</div>
								
						<div class="picture" id="pic5" style="position: relative;">	
							<a href="#" class="a-upload" id="im5">
							    <input id="file_upload5" type="file" name="img5" class="pics addpic" />
							    <div class="image_container" style="z-index:-1;">
							        <img id="preview5" class="imgs">
							    </div>       
							</a>
						</div>
						<div class="picture" id="pic6" style="position: relative;">	
							<a href="#" class="a-upload" id="im6">
							    <input id="file_upload6" type="file" name="img6" class="pics addpic" />
							    <div class="image_container" style="z-index:-1;">
							        <img id="preview6" class="imgs">
							    </div>       
							</a>
						</div> 
						<div class="picture" id="pic7" style="position: relative;">	
							<a href="#" class="a-upload" id="im7">
							    <input id="file_upload7" type="file" name="img7" class="pics addpic" />
							    <div class="image_container" style="z-index:-1;">
							        <img id="preview7" class="imgs" >
							    </div>       
							</a>
						</div> 
						<div class="picture" id="pic8" style="position: relative;">	
							<a href="#" class="a-upload" id="im8">
							    <input id="file_upload8" type="file" name="img8" class="pics addpic" />
							    <div class="image_container" style="z-index:-1;">
							        <img id="preview8" class="imgs">
							    </div>       
							</a>
						</div> 
					</div>
      </div>
      <div class="form-group">
        <div class="label">
          <label></label>
        </div>
        <div class="field">
          <button class="button bg-main icon-check-square-o" type="button" onclick="javascript:sub();"> 提交</button>
          <input type="hidden" name="subTag" id="subTag"/>
        </div>
      </div>
    </form>
  </div>
</div>
</body>
 <script type="text/javascript" src="<%=path%>/admin/js/layer/layer.js" ></script>
<script type="text/javascript">
	$(function(){
		var tags = '${plan.planTag}';
		var taglist = tags.split(",");
		$("#hangye").val(taglist[0]);
		$("#jieri").val(taglist[1]);
		$("#gongneng").val(taglist[2]);
		
		/* var imgpath = '${imgPath}';
		var pics = '${plan.planPics}';
		var piclist = pics.split(",");
		var img1 = imgpath+piclist[0];
		alert(img1);
		$("#preview1").attr("src",imgpath+piclist[0]);
		$("#preview2").attr("src",imgpath+piclist[1]); */
		var address = paths+"/file/getImg.html?saveAddress=";
		var pic = '${plan.planCover}';
		 for (var i = 0; i < piclist.length; i++) {
			if(piclist[i] != ''){
				var j = i+1;
				$("#preview"+j).attr("src",address+piclist[i]);
			}
			
		} 
	 if(pic != ''){
			/* $("#preview10").attr("src",address+pic); */
			$("#view").css({ "width":"356px","height":"260px","background-image":"url("+address+pic+")"});
			$("#view").css({ "background-color":" rgb(102, 102, 102)","background-repeat":"no-repeat","background-position":"center center","background-size":"contain"});
		}
	 //planTag选中
	var tas = tags.split(',');
	 for (var i = 0; i < tas.length; i++) {
		 $("input[name='checkTag']").each(function(){
			 if($(this).val()==tas[i]){
				 $(this).attr("checked","checked");
			 }
		 });
	}
	
		
	});
	
	function sub(){
		<%-- var params = {};
		params["planId"] = $("#planId").val();
		params["planName"] = $("#planName").val();
		params["planDescription"] = $("#planDescription").val();
		params["planCompnay"] = $("#planCompnay").val();
		params["planTag"] = $("#planTag").val();
		params["planUrl"] = $("#planUrl").val();
		params["planPics"] = $("#planPics").val();
		$.ajax({
			type:"post",
			url:"<%=path%>/admin/updatePlan",
			data:params,
			success:function(data){

					/* if(data>0){
						layer.msg('操作成功！');
						$(".clear").val("");
						$("#planTag").val(",,");
						$("select").val("");
						$("#planPics").val(",,,,,,,");
						$(".imgs").attr("src","");
					}else{
						layer.msg('系统忙！');
					} */
				
			}
		}); --%>
		$("#planForm").submit();
	};
	

	$(".plantags").change(function(){
		var roleitem = "";
		$("input[name='checkTag']").each(function(){
			if($(this).prop("checked")){
				if(roleitem == ""){
				roleitem += $(this).val();
				}
				else{
				roleitem += ","+$(this).val();
				}
			}
		});
		$("#planTag").val(roleitem);
		
		
	});
</script>
<script src="http://www.jq22.com/jquery/2.1.1/jquery.min.js"></script>

<%-- <script src="<%=path %>/admin/js/img/jquery-2.1.1.min.js"></script> --%>
<script>window.jQuery || document.write('<script src="<%=path%>/admin/js/img/jquery-2.1.1.min.js"><\/script>')</script>
<script src="<%=path %>/admin/js/img/iscroll-zoom.js"></script>
<script src="<%=path %>/admin/js/img/jquery.photoClip.js"></script>
<script src="<%=path %>/admin/js/img/photoLayer.js"></script>
<script type="text/javascript">
/* $("#clipArea").photoClip({
	width: 356,
	height: 260,
	file: "#addfile",
	view: "#view",
	ok: "#file_upload10",
	loadStart: function() {
		console.log("照片读取中");
	},
	loadComplete: function() {
		console.log("照片读取完成");
	},
	clipFinish: function(dataURL) {
		console.log(dataURL);
	}
}); */
</script>
</html>